1) 查询所有具有某关键词的object:
DECLARE @Search VARCHAR(100)
set @Search='spread[_]schedules'-- 修改为你要查询的关键词
SELECT o.name[Object Name],
CASE O.xtype WHEN 'P' THEN 'Stored procedure'
WHEN 'RF' THEN 'Replication filter stored procedure'
WHEN 'TR' THEN 'Trigger'
WHEN 'FN' THEN 'Scalar function'
WHEN 'IF' THEN 'In-lined table-function'
WHEN 'IT' THEN 'Internal table'
WHEN 'TF' THEN 'Table function'
WHEN 'V' THEN 'View'
WHEN 'X' THEN 'Extended stored procedure'
ELSE ' ' END[Object Type]
FROM syscomments c
INNER JOIN sysobjects o on o.id=c.id
WHERE text like '%' +@Search +'%'
ORDER BY [Object Name],[Object Type]