Capturing the text of a prepared SQL statement run with sp_execute

Many times when running a trace against SQL Server you'll see RPC:Completed events that look like this:


This is a companion discussion topic for the original entry at http://billg.sqlteam.com/2008/10/10/capturing-the-text-of-a-prepared-sql-statement-run-with/