IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[WEBSERVICE_LOGIN]')
AND name = 'PIN_HASH')
ALTER TABLE [dbo].[WEBSERVICE_LOGIN] ADD PIN_HASH VARCHAR(128)

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[AUTOS_GRUPPEN_MERKMALE]')
AND name = 'Appicon')
ALTER TABLE [dbo].[AUTOS_GRUPPEN_MERKMALE] ADD Appicon VARCHAR(50)

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[AUTOS]')
AND name = 'FUEL_LEVEL')
ALTER TABLE AUTOS ADD FUEL_LEVEL INT

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[AUTOS]')
AND name = 'LONGITUDE')
ALTER TABLE AUTOS ADD LONGITUDE FLOAT 

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[AUTOS]')
AND name = 'LATITUDE')
ALTER TABLE AUTOS ADD LATITUDE FLOAT

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[KUNDEN]')
AND name = 'CCOCI_PROTO_AUTOMATIK')
ALTER TABLE KUNDEN ADD CCOCI_PROTO_AUTOMATIK BIT NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[bilder]')
AND name = 'PKview')
ALTER TABLE bilder ADD PKview INTEGER

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[KUNDEN]')
AND name = 'PostIdentUrl')
ALTER TABLE KUNDEN ADD PostIdentUrl varchar(255) NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'bluetoothkey')
ALTER TABLE MIETVERTRAEGE ADD bluetoothkey VARCHAR(2000)
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'cloudboxx_session')
ALTER TABLE MIETVERTRAEGE ADD cloudboxx_session VARCHAR(200)
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_EVENT_OPEN')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_EVENT_OPEN DATETIME
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_EVENT_CLOSE')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_EVENT_CLOSE DATETIME
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_KM_OPEN')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_KM_OPEN INT
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_KM_CLOSE')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_KM_CLOSE INT
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_POSITION_OPEN')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_POSITION_OPEN VARCHAR(50)
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_POSITION_CLOSE')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_POSITION_CLOSE VARCHAR(50)
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_FUEL_LEVEL_OPEN')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_FUEL_LEVEL_OPEN INT
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_FUEL_LEVEL_CLOSE')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_FUEL_LEVEL_CLOSE INT
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_BT_UUID')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_BT_UUID VARCHAR(50)
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_SESSIONID_OPEN_CLOSE')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_SESSIONID_OPEN_CLOSE VARCHAR(50)
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_BT_OPEN_CLOSE')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_BT_OPEN_CLOSE VARCHAR(50)
IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[MIETVERTRAEGE]')
AND name = 'CS_BOX_BT_UUID_OPEN_CLOSE')
ALTER TABLE MIETVERTRAEGE ADD CS_BOX_BT_UUID_OPEN_CLOSE VARCHAR(50)

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[CSAPP_INVERS_IMMOBILIZER_CHANGED_EVENTS]')
AND name = 'bluetoothKeyUuid')

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[CSAPP_CAMERA_VIEWS]')
AND name = 'IMAGES')
ALTER TABLE CSAPP_CAMERA_VIEWS ADD IMAGES VARCHAR(50) NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[CSAPP_CAMERA_VIEWS]')
AND name = 'MARKABLE')
ALTER TABLE CSAPP_CAMERA_VIEWS ADD MARKABLE bit NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[stammt]')
AND name = 'CSAPP_STANDARD_PL')
ALTER TABLE stammt ADD CSAPP_STANDARD_PL VARCHAR(255) NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[stammt]')
AND name = 'CSAPP_SHOW_RES_TYPE_SCREEN')
ALTER TABLE stammt ADD CSAPP_SHOW_RES_TYPE_SCREEN bit NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[CSAPP_CHECKLISTS]')
AND name = 'Obligatorisch')
ALTER TABLE CSAPP_CHECKLISTS ADD Obligatorisch bit NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[CSAPP_CHECKLISTS]')
AND name = 'CI')
ALTER TABLE CSAPP_CHECKLISTS ADD CI bit NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[CSAPP_CHECKLISTS]')
AND name = 'CO')
ALTER TABLE CSAPP_CHECKLISTS ADD CO bit NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[AUTOS]')
AND name = 'CCHEQ_MAIL_SENT')
ALTER TABLE AUTOS ADD CCHEQ_MAIL_SENT bit NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[SCHAEDEN]')
AND name = 'CCHEQ_MAIL_SENT')
ALTER TABLE SCHAEDEN ADD CCHEQ_MAIL_SENT bit NULL

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[CSAPP_INVERS_IMMOBILIZER_CHANGED_EVENTS]')
AND name = 'bluetoothKeyUuid')
ALTER TABLE CSAPP_INVERS_IMMOBILIZER_CHANGED_EVENTS ADD bluetoothKeyUuid varchar(255)

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[KUNDEN_EMAIL_ADRESSEN]')
AND name = 'PK_STANDARDMAILTYP')
ALTER TABLE KUNDEN_EMAIL_ADRESSEN ADD PK_STANDARDMAILTYP integer

ALTER TABLE [dbo].[CSAPP_CAMERA_VIEWS] ENABLE TRIGGER [CSAPP_CAMERA_VIEWS_CHANGED]

ALTER TABLE [dbo].[CSAPP_IMAGES] ENABLE TRIGGER [CSAPP_IMAGES_CHANGED]

ALTER TABLE [dbo].[CSAPP_PROTOCOL_GROUPS] ENABLE TRIGGER [CSAPP_PROTOCOL_GROUPS_CHANGED]

ALTER TABLE [dbo].[CSAPP_PROTOCOL_GROUPS_REL_TYPES] ENABLE TRIGGER [CSAPP_PROTOCOL_GROUPS_REL_TYPES_CHANGED]

ALTER TABLE [dbo].[CSAPP_PROTOCOL_OPTIONS] ENABLE TRIGGER [CSAPP_PROTOCOL_OPTIONS_CHANGED]

ALTER TABLE [dbo].[CSAPP_PROTOCOL_TYPES] ENABLE TRIGGER [CSAPP_PROTOCOL_TYPES_CHANGED]

ALTER TABLE [dbo].[CSAPP_PROTOCOL_TYPES_REL_OPTIONS] ENABLE TRIGGER [CSAPP_PROTOCOL_TYPES_REL_OPTIONS_CHANGED]

ALTER TABLE [dbo].[AUTOS_KFZ_GRUPPEN] ENABLE TRIGGER [AUTOS_KFZ_GRUPPEN_CHANGED]

ALTER TABLE [dbo].[AUTOS_KFZ_GRUPPEN_MERKMALE] ENABLE TRIGGER [AUTOS_KFZ_GRUPPEN_MERKMALE_CHANGED]

ALTER TABLE [dbo].[PARAMS] ENABLE TRIGGER [PARAMS_CHANGED]

ALTER TABLE [dbo].[Stammt] ENABLE TRIGGER [STAMMT_CHANGED]

ALTER TABLE [dbo].[FARBEN] ENABLE TRIGGER [FARBEN_CHANGED]

ALTER TABLE [dbo].[CSAPP_NEWS] ENABLE TRIGGER [CSAPP_NEWS_CHANGED]
