USE master 


/* declare variables */
DECLARE @variable VARCHAR(100)

DECLARE lookupCrs CURSOR FAST_FORWARD READ_ONLY FOR SELECT  name FROM sys.databases d

OPEN lookupCrs

FETCH NEXT FROM lookupCrs INTO @variable

WHILE @@FETCH_STATUS = 0
BEGIN
    DECLARE @q NVARCHAR(MAX) = '
use '+@variable+'

SELECT
    DB_NAME() AS [db_name], 
    name, object_id, principal_id, schema_id, parent_object_id, type, type_desc, create_date, modify_date, is_ms_shipped, is_published, is_schema_published
FROM sys.[objects]
WHERE [name] LIKE ''%sp_ReplCustom_Address_ins_C%''
AND [type]=''P''
;
';
PRINT @q
EXEC [sys].[sp_executesql]
    @q
    ,N'@db varchar(100)'
    ,@variable
    ;

    FETCH NEXT FROM lookupCrs INTO @variable
END

CLOSE lookupCrs
DEALLOCATE lookupCrs


