IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name = N'CanBeDeleted'  AND Object_ID = Object_ID(N'[BA_Role]'))
BEGIN
	ALTER TABLE [dbo].[BA_Role] ADD CanBeDeleted bit NOT NULL DEFAULT(1)
END;

IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name = N'CanBeModified'   AND Object_ID = Object_ID(N'[BA_Role]'))
BEGIN
	ALTER TABLE [dbo].[BA_Role] ADD CanBeModified bit NOT NULL DEFAULT(1)
END;

IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name = N'InternalName'   AND Object_ID = Object_ID(N'[BA_Role]'))
BEGIN
	ALTER TABLE [dbo].[BA_Role] ADD InternalName NVARCHAR (256) NOT NULL DEFAULT('')
END;   

IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name = N'Instance_id'  AND Object_ID = Object_ID(N'[BA_Role]'))
BEGIN
	ALTER TABLE [dbo].[BA_Role] ADD Instance_id int NULL
END;


--IF NOT EXISTS(
--    SELECT *
--    FROM sys.columns 
--    WHERE Name = N'IsDefaultRole'   AND Object_ID = Object_ID(N'[BA_Role]'))
--BEGIN
--	ALTER TABLE [dbo].[BA_Role] ADD IsDefaultRole bit NOT NULL DEFAULT(0)
--END;