 IF 0 = (SELECT COUNT (*) FROM LOCKEDCUSTOMERS (NOLOCK)) 
  
   IF 0 =  
    (
        SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS 
        WHERE CONSTRAINT_TYPE = 'PRIMARY KEY' 
        AND TABLE_SCHEMA = 'dbo' 
        AND TABLE_NAME = 'LockedCustomers' 
    )
        ALTER TABLE LockedCustomers ADD CONSTRAINT PK_LockedCustomers PRIMARY KEY (CustomerNumber)