IF EXISTS (SELECT * FROM sys.key_constraints WHERE type = 'PK' AND parent_object_id = OBJECT_ID('MyTable') AND Name = 'PK_MyTable') ALTER TABLE MyTable DROP CONSTRAINT PK_MyTable