使用游标过滤包含#开头的存储过程
declare @name varchar(300)
declare mycur cursor forselect name from sysobjects o,syscomments s
where o.id = s.id and o.xtype ='p' and text like '%#%' and o.xtypr = 'P'
open mycur
fetch next from mycur into @name
while @@FETCH_STATUS = 0
begin
exec('exec sp_helptext ' + @name)
fetch next from mycur into @name
end
close mycur
deallocate mycur
go