If you want to search a string in stored procedures, functions and views, maybe you can use some special tools.

But, for instance, suppose that you can only use SQL Server Management Studio.

Is there a way to do this?

Yes….

You could use the following query:

SELECT DISTINCT OBJECT_NAME(id) AS [OBJECT_NAME]
FROM sys.syscomments
WHERE [TEXT] LIKE '%text to search%'
ORDER BY OBJECT_NAME(id)

Of course you have to replace ‘text to search’ with the string you want to search (leave the ‘%’ characters!).

 

Best regards,

The Dummy Programmer