SQL – Search Text in Stored Procedure

There is below few questions which will ask you while Interview or Any time …
How can I find if particular table is being used in the stored procedure?
How to search in stored procedures?
How can I do dependency check for objects in stored procedure without using sp_depends?

The same feature can be implemented using following script.

–Searching the text or tableName in Stored Procedure
SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE ‘%tableName or any text%’

Leave a comment

Design a site like this with WordPress.com
Get started