Word search query

Search trough all database and stored procedureS and views for a specific word.

USE master
GO
-- FIND COLUMN 
DECLARE @FindColumn NVARCHAR(128) = '<COLUMN TO SEARCH FOR>'
-- PRINT DYNAMIC SQL STATEMENT INSTEAD OF EXECUTING IT
DECLARE @Debug BIT = 0
-- CRAETE TEMP TABLE TO STORE THE RESULT
CREATE TABLE #SearchResult (DbName SYSNAME, ObjectName SYSNAME, ObjectType SYSNAME)

-- DYNAMIC SQL SETTINGS
DECLARE @parm NVARCHAR(41)
SET @parm = '@FindColumn nvarchar(128)'
DECLARE @SQL NVARCHAR(MAX)
SET @SQL = 'exec sp_msforeachdb ''use [?];
SELECT 
 DbName =  ''''?''''
,ObjectName = obj.name
,ObjectType = obj.type
FROM sys.syscomments sc
INNER JOIN sys.objects obj ON sc.Id = obj.OBJECT_ID
WHERE sc.TEXT LIKE ''''%'+@FindColumn+'%'''' escape ''''['''''''

IF @Debug =1 
BEGIN
    PRINT @SQL
END ELSE

INSERT INTO #SearchResult (DbName, ObjectName, ObjectType)
EXEC SP_EXECUTESQL @SQL, @PARM, @FindColumn

SELECT * FROM #SearchResult
DROP TABLE #SearchResult
GO