select name, type_desc from sys.all_sql_modules s inner join sys.all_objects o on s.object_id = o.object_id where definition like '%关键字%' order by type_desc, name;
select name, xtype from sysobjects o, syscomments s where o.id = s.id and text like '%agent%';
--查询所有包含某列名的对象 select name, object_id, type, type_desc from sys.objects where object_id in ( select object_id from sys.columns where name = 'serverid' );