This Query can search any string value (table name, table data etc) from all the tables/views of any SQL Server database, when you will place any string at \"your te
search given string in the procedures/functions/triggers
This is actually far easier.
SELECT OBJECT_NAME(object_id), definition
FROM sys.sql_modules
WHERE definition LIKE '%'+@SearchStr+'%'
One way to use it is to add it to the end of your TSQL code, i.e modify the last SELECT:
SELECT ColumnName, ColumnValue
FROM @Results
UNION ALL
SELECT OBJECT_NAME(object_id), definition
FROM sys.sql_modules
WHERE definition LIKE '%'+@SearchStr+'%'
Personally, I'd just run them separately one after the other as separate statements.