Declare @ColumnName Varchar(20)
Declare @ConstraintName varchar(100)

Select @ColumnName = column_name, @ConstraintName = CONSTRAINT_NAME 
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE OBJECTPROPERTY(OBJECT_ID(constraint_name), 'IsPrimaryKey') = 1
AND table_name = 'RepEkhtetam'

IF @ConstraintName <> ''   
Begin
  Exec ('ALTER TABLE [dbo].[RepEkhtetam] DROP CONSTRAINT ' + @ConstraintName)
  Alter Table RepEkhtetam Alter Column Autoid int  
  Alter Table Dbo.RepEkhtetam Add Constraint Pk_RepEkhtetam Primary Key (Autoid)    
End
