• You need to add extra logic to the CREATE LOGIN section of your script to obtain the SID of the new (or existing) login. Then, in the CREATE USER section, you need to check both that the user name you want to create doesn't already exist, and that there isn't already a user in the database with the SID (certainly shouldn't be if you just created the login).

    John