Msg 137, Level 15, State 2, Line 1. Must declare the scalar variable â@AuthorNameâ. Reason for this error: In the above example, the variable @AuthorName is used in the statement executed by EXECUTE statement. EXECUTE statement doesnât have the visibility of the variables declared outside of it.