Object Reference Not Set ... Debugging Stored Procedure in Visual Studio
Do you have DELIMITER statements around the CREATE...?

Does VS have any way to debug Stored Routines?  (I suspect not.)

The failure to do it this way could cause trouble later:

START TRANSACTION;
SELECT ... from users ... FOR UPDATE;
various SETs
UPDATE ...;
COMMIT;


Another consideration...  An "audit trail" may be better achieved via a TRIGGER wherein you can compare NEW. to OLD..