How to search the entire database for a string value or GUID

Courtesy of The Manageability Team Blog - https://blogs.technet.com/smsandmom/archive/2008/11/17/opsmgr-2007-how-to-search-the-entire-database-for-a-string-value-or-guid.aspx