Searching the MetaData of a SQL Server Database, Stored Procedure Text

This has been a favorite stored procedure of mine to search the text of my stored procedures for certain phrases... really helpful as the number of stored procs you have grows quite a bit:

 --xps '%procedure%' --search for the word 'procedure' in all your stored procs

CREATE proc [dbo].[xpS]

@sSystemObjectText nvarchar(1000)


select distinct

from sysobjects inner join syscomments on

where syscomments.text like @sSystemObjectText

order by name

Skip to main content