DECLARE @IsEnabled BIT

select @IsEnabled = KEYVALUE from HOTELSETUP (nolock) where SEARCHKEY = 'EmailExchangeWSEnabled'

IF @IsEnabled = 1
BEGIN
  EXEC HotelSetupSettingUpdateValue 'EmailExchangeWSEnabledGUI', '1'
  EXEC HotelSetupSettingUpdateValue 'EmailExchangeWSEnabledNonGUI', '1'
  EXEC HotelSetupSettingUpdateValue 'EmailEnableStandardGUI', '0'
  EXEC HotelSetupSettingUpdateValue 'EmailEnableStandardNonGUI', '0'
END