You do not need use CMSContext, it should work without it. In your page with data source add static text web part and put this into text property:
You might just have NumID=null in the DB for a user whom you are running this macro. Check NumID in the DB for UserName and UserID. Check this page with different users. If you open incognito browser window user will be public (Userid = 65).
Check the Kentico event log for macro security errors. If there is none - it is not a security issue. Usually resaving macro solves the issue. If saving does not help you might try to resign all macros