how to know in which database is a sql server procedure?

0

Good I would like you to help me, I have 100 database and I would like to find a stored procedure, with a query to show me the location of the database that has that procedure:

I have made this script but as long as I am in a specific database it shows me. But when I am in the master bd and I do not show, what I would like when I am in the master bd, execute a script and tell me in which database is

SELECT *
FROM sys.sql_modules
WHERE OBJECT_NAME(OBJECT_ID) = 'nombre de procedimiento'
    
asked by PieroDev 11.11.2017 в 00:15
source

1 answer

1

EXEC sp_msforeachdb 'if exists (select 1 from [?]. sys.objects where name =' 'procedure name' ') select ''? '' as FoundInDatabase from [?]. sys.objects where name = '' procedure name '' '

    
answered by 11.11.2017 / 00:50
source