Here are two alternatives to sp_MSforeachdb
And then this one that I have been using:
http://spaghettidba.com/2011/09/09/a-better-sp_msforeachdb/
With a few samples of usage here
http://jasonbrimhall.info/2012/07/17/a-trio-of-eachdb/
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events