Sql Server add auto increment primary key to existing table

ALTER TABLE dbo.YourTable
ADD ID INT IDENTITY

and then you can make it the primary key:

ALTER TABLE dbo.YourTable
ADD CONSTRAINT PK_YourTable
PRIMARY KEY(ID)

Posted in SQL