Yeah, you're on right track but usually in SQL server, EXECUTE() does not validate expressions like FORMATMESSAGE(), as these are not allowed directly. But to use them both together a variable can be used to hold the result of FORMATMESSAGE() first, then pass that variable to Exec.