update Versao
set PatchVersao = 2
where versao = 3
  and subversao = 1
GO

if not exists (Select * from dbo.SysColumns Where id = object_id(N'[dbo].[Usuarios]') and 
                                                 Name Like 'FlagCriptografiaSSL' And
                                                 OBJECTPROPERTY(id, N'IsUserTable') = 1 )
begin                                                
  alter table Usuarios add FlagCriptografiaSSL smallint                         
end
go

exec sp_bindefault 'Dbo.Numero', 'Usuarios.FlagCriptografiaSSL'
go

update Usuarios
  set FlagCriptografiaSSL = 0
where FlagCriptografiaSSL is null                           
go 

alter table Usuarios alter column FlagCriptografiaSSL smallint not null
go