declare @procName nvarchar(max) = ‘GSP_GP_EfficacyAccounts_test’;
declare @procSql nvarchar(max) =’if exists(select 1 from [?].sys.objects where name=”’+@procName+”’)
select ”?” as 数据库名称,name as 存储过程名称 from [?].sys.objects where name=”’+@procName+””;
EXEC sp_msforeachdb @procSql