During preparation of replication from remote site to central office I stumbled upon a need to check definitions of all views in a database. The script is simple, yet useful:
select sv.name, sc.text from sys.views sv inner join dbo.syscomments sc on sv.object_id = sc.id where sv.is_ms_shipped = 0
You get all the non-system views – if you’re looking for a specific text in a script, just drop another conditions in WHERE clause and you’re done. I – for instance – was able to locate all views referencing linked servers.