I am connected to server XYZ as User A. I open a query window to create a stored procedure but it errors with:
Msg 18456, Level 14, State 1, Line 1
Login failed for user 'B'.
Msg 4064, Level 11, State 1, Line 1
Cannot open user default database. Login failed.
Why is it saying Login failed for user 'B'? I am logged in as user A and the code does not have anything to switch the context to user B.