SQL: How to Find Text in Stored Procedures

Searching for Text in a SQL Stored Procedure

I always write a blog article on things that took me a little to time to find when I working on various projects.

I’m working a project with another developer and they had sent me a screenshot of a SQL stored procedure that I needed to look at but they didn’t tell me the name of the file.

I needed to take some text from the screenshot and figure out which stored procedure it was in out of 100 or more.

Below is an example of the SQL script I used to find the text I was looking for. You’ll be searching the definition for you specific text.

SQL Script Example:
Find Text in Stored Procedures

       o.name AS Object_Name,
FROM sys.sql_modules m
       sys.objects o
         ON m.object_id = o.object_id
WHERE m.definition Like '%@RowString%';

I hope this help you solve your issue!

~Cyber Abyss

Author: Rick Cable / AKA Cyber Abyss

- 16 year US Navy Veteran. - 20 years in software development and many other IT roles. - Currently in role as senior full-stack software developer supporting multiple teams and products at a large healthcare organization. - Part-time Hacking, Lock Picking and OSINT enthusiast. - Founder of FinditClassifieds.com in 1997 to present. - Co-founder of LK2 Software 1999-2002.