I ran the original code and got this error (v2000)
Server: Msg 2812, Level 16, State 62, Line 7
Could not find stored procedure 'msdb.dbo.sysmail_help_profile_sp'.
Server: Msg 2812, Level 16, State 62, Line 17
Could not find stored procedure 'msdb.dbo.sysmail_help_profileaccount_sp'.
Server: Msg 2812, Level 16, State 62, Line 34
Could not find stored procedure 'msdb.dbo.sysmail_help_account_sp'.
(0 row(s) affected)
Rob Maurer