SQL SERVER 根据代码内容查找存储过程或者触发器等
select o.*,'|',m.*
from sys.objects o join sys.sql_modules m on o.object_id = m.object_id
where m.definition like '%代码段%'
--也可以使用SQL SERVER 2000中的视图syscomments
select c.*
from sys.objects o join syscomments c on o.object_id = c.id
where o.type = 'p' and c.text like '%代码段%'