Login Stuck in Database? I'm working on a project to add some permission-based roles to our database servers to restrict users from modifying data if they don't need to be doing so. I've got four groups for each client; Users, PreProd Users, Data Admins, and PreProd Data Admins. I've got things set up fine for the users, but I'm running into some trouble with the Admin side.

I'm very new to SQL, so a lot of my testing is trial and error. I think I may have botched something quite badly though. Two of my Logins, demo_Data_PP_Admin, and demo_Data_Admin, seem to be stuck. When I paste my script in to CREATE those logins, I am told that the logins already exist. Visually, I can confirm they do not exist. Attempts to DROP LOGIN [demo_Data_PP_Admin] or DROP LOGIN [demo_Data_Admin] are met with 

Msg 15151, Level 16, State 1, Line 1
Cannot drop the login 'dh\demo_Data_Admin', because it does not exist or 
you do not have permission.


I know this is a super confusing issue, and I'm trying to sort it all out myself with my relatively beginner knowledge here. 

TL;DR, the command CREATE LOGIN [dh\demo_Data_Admin] FROM WINDOWS WITH DEFAULT_DATABASE=[master]
GO has a red underline beneath [dh\demo_Data_Admin], claiming the login already exists, but I can visually confirm that it does not. 

I can try my best to answer any questions that people may have. Again, I apologize for the confusing nature and potentially confusing explanation of events. An answer to this question will likely lead to another question as well.
IntelliSense gets confused occasionally. 

Try refreshing the IntelliSense cache by pressing CTRL-SHIFT-R or hit "Edit -> IntelliSense -> Refresh Local Cache" from the menu-bar to see if the underline goes away.

Alternately, try running CREATE LOGIN [dh\demo_Data_Admin] FROM WINDOWS WITH DEFAULT_DATABASE=[master] - if the login already exists, this will return an error.  If no error is thrown, the login didn't already exist, and has now been created.

You can check if the login exists with this query:

SELECT *
FROM sys.server_principals sp
WHERE sp.name = 'dh\demo_Data_Admin';


If the login exists, a row will be returned with details about the login.