Они должны работать в разных партиях:
declare @new bit = 0;
IF NOT EXISTS (SELECT * FROM sys.all_columns
WHERE object_id = OBJECT_ID(N'MyTable') and NAME = 'MyAttribute')
BEGIN
set @new = 1;
ALTER TABLE MyTable ADD MyAttribute BIT NOT NULL DEFAULT(0);
END
Go
if @new = 1
begin
UPDATE MyTable SET MyAttribute = 1;
end
РЕДАКТИРОВАТЬ:
IF NOT EXISTS (SELECT * FROM sys.all_columns
WHERE object_id = OBJECT_ID(N'MyTable') and NAME = 'MyAttribute')
BEGIN
ALTER TABLE MyTable
ADD MyAttribute BIT NOT NULL
CONSTRAINT df_attr DEFAULT(1);
ALTER TABLE MyTable
DROP CONSTRAINT df_attr;
ALTER TABLE MyTable
ADD CONSTRAINT df_attr DEFAULT 0 FOR MyAttribute;
END