Let’s say you remember a piece of code you need to optimize or take a look at, but you don’t remember in which stored procedure you saw it.
The following script searches for a certain string inside the code of all programmatic objects in the database (stored procedures, triggers, views and user defined functions), and returns the objects which contain it.
select object_name(object_id) as object_name,definition from sys.sql_modules where definition like '%Your String Here%'
The post How to Find Objects that Contain a Certain String in SQL Server appeared first on .