1) Search in All Objects
This script search stored procedures, views, functions as well other objects.
-- Search in All Objects
SELECT OBJECT_NAME(OBJECT_ID),
definition
FROM sys.sql_modules
WHERE definition LIKE '%' + 'studentCode' + '%'
GO
2) Search in Stored Procedure
-- Search in Stored Procedure Only
SELECT DISTINCT OBJECT_NAME(OBJECT_ID),object_definition(OBJECT_ID)FROM sys.ProceduresWHERE object_definition(OBJECT_ID) LIKE '%' + 'studentCode' +'%'GO
Comments