Just run the SQL Profiler and use EM to make the change you'll see all the code it takes to do this task.Something likeset implicit_transactions on SET TEXTSIZE 2147483647goBEGIN TRANSACTIONgoEXECUTE sp_MSobjectprivs N'dbo.TableID2'goselect xp.name, cast(xp.[value] as nvarchar(4000)), cast(SQL_VARIANT_PROPERTY(xp.[value], 'BaseType') as nvarchar(256)), cast(SQL_VARIANT_PROPERTY(xp.[value], 'MaxLength') as int), cast(SQL_VARIANT_PROPERTY(xp.[value], 'Precision') as int), cast(SQL_VARIANT_PROPERTY(xp.[value], 'Scale') as int)from ::fn_listextendedproperty(NULL, N'user', N'dbo', N'table', N'TableID2', NULL, NULL) xp where xp.name not in (N'MS_Description', N'MS_Filter', N'MS_OrderBy', N'MS_SubdatasheetName', N'MS_LinkChildFields', N'MS_LinkMasterFields', N'MS_SubdatasheetHeight', N'MS_SubdatasheetExpanded') godeclare @P1 intset @P1=180150012declare @P2 intset @P2=8declare @P3 intset @P3=1declare @P4 intset @P4=0exec sp_cursoropen @P1 output, N'select xp.name, cast(xp.[value] as nvarchar(4000)), cast(SQL_VARIANT_PROPERTY(xp.[value], ''BaseType'') as nvarchar(256)), cast(SQL_VARIANT_PROPERTY(xp.[value], ''MaxLength'') as int), cast(SQL_VARIANT_PROPERTY(xp.[value], ''Precision'') as int), cast(SQL_VARIANT_PROPERTY(xp.[value], ''Scale'') as int)from ::fn_listextendedproperty(NULL, N''user'', N''dbo'', N''table'', N''TableID2'', N''column'', N''ID'') xp where xp.name not in (N''MS_Description'', N''MS_Format'', N''MS_InputMask'', N''MS_NumberOfDecimals'', N''MS_AllowBlanks'', N''MS_Caption'', N''MS_DisplayControl'', N''MS_RowSourceType'', N''MS_RowSource'', N''MS_BoundColumn'', N''MS_ColumnCount'', N''MS_ColumnHeads'', N''MS_ColumnWidths'', N''MS_ListRows'', N''MS_ListWidth'', N''MS_LimitToList'') ', @P2 output, @P3 output, @P4 outputselect @P1, @P2, @P3, @P4goexec sp_cursorfetch 180150012, 2, 5, 5godeclare @P1 intset @P1=180150013declare @P2 intset @P2=8declare @P3 intset @P3=1declare @P4 intset @P4=0exec sp_cursoropen @P1 output, N'select xp.name, cast(xp.[value] as nvarchar(4000)), cast(SQL_VARIANT_PROPERTY(xp.[value], ''BaseType'') as nvarchar(256)), cast(SQL_VARIANT_PROPERTY(xp.[value], ''MaxLength'') as int), cast(SQL_VARIANT_PROPERTY(xp.[value], ''Precision'') as int), cast(SQL_VARIANT_PROPERTY(xp.[value], ''Scale'') as int)from ::fn_listextendedproperty(NULL, N''user'', N''dbo'', N''table'', N''TableID2'', N''constraint'', N''PK_TableID2'') xp where xp.name not in (N''MS_ConstraintText'') ', @P2 output, @P3 output, @P4 outputselect @P1, @P2, @P3, @P4goexec sp_cursorfetch 180150013, 2, 5, 5goCREATE TABLE dbo.Tmp_TableID2 ( ID int NOT NULL IDENTITY (1, 1) ) ON [PRIMARY]goSET IDENTITY_INSERT dbo.Tmp_TableID2 ONgoIF EXISTS(SELECT * FROM dbo.TableID2) EXEC('INSERT INTO dbo.Tmp_TableID2 (ID) SELECT ID FROM dbo.TableID2 TABLOCKX')goSET IDENTITY_INSERT dbo.Tmp_TableID2 OFFgoDROP TABLE dbo.TableID2godeclare @P1 intset @P1=0declare @P2 intset @P2=16388declare @P3 intset @P3=8193declare @P4 intset @P4=0exec sp_cursoropen @P1 output, N'EXECUTE sp_rename N''dbo.Tmp_TableID2'', N''TableID2'', ''OBJECT''', @P2 output, @P3 output, @P4 outputselect @P1, @P2, @P3, @P4goALTER TABLE dbo.TableID2 ADD CONSTRAINT PK_TableID2 PRIMARY KEY CLUSTERED ( ID ) ON [PRIMARY]goCOMMIT