Searching string within MSSQL objects (SP,View,Function,ETC)

SELECT sys.objects.object_id, AS [Schema], AS Object_Name, sys.objects.type_desc AS [Type]
FROM sys.sql_modules (NOLOCK)
INNER JOIN sys.objects (NOLOCK) ON sys.sql_modules.object_id = sys.objects.object_id
INNER JOIN sys.schemas (NOLOCK) ON sys.objects.schema_id = sys.schemas.schema_id
sys.sql_modules.definition COLLATE SQL_Latin1_General_CP1_CI_AS LIKE ‘%Column_Name%’ ESCAPE ‘\’
ORDER BY sys.objects.type_desc,,

Replace Column_Name with intended search string.

Leave a Reply

Your email address will not be published. Required fields are marked *