declare @createOrAlter nvarchar(6);
set @createOrAlter = case when object_id('dbo.UserInfo') IS NULL then N'create' else N'alter' end;
exec (@createOrAlter + N' view dbo.UserInfo
as
select
    s.ID
    ,s.Name
    ,a.FullName
    ,s.IsAdministrator
    ,s.CanAdd
    ,s.CanDelete
    ,s.CanEdit
    ,a.ConnectionOverrides
    ,s.CustomSecurity
    ,a.IsTemplate
    ,s.DataSourceID
    ,s.CanAddCredentials
    ,s.CanAddDataEntry
    ,s.CanEditCredentials
    ,s.CanEditDataEntry
    ,s.CanDeleteCredentials
    ,s.CanDeleteDataEntry
    ,s.IsEnabled
    ,s.CreationDate
    ,a.Email
    ,a.IsOwner
    ,a.Password
    ,a.PasswordSalt
    ,s.IsLockedOut
    ,a.LastLoginDate
    ,a.LastPasswordChangedDate
    ,s.LastLockoutDate
    ,s.FailedPasswordAttemptCount
    ,s.FailedPasswordAttemptWindowStart
    ,s.UserType
    ,a.PersonalConnectionCacheID
    ,a.PersonalConnections
from dbo.UserAccount a
    inner join dbo.UserSecurity s on a.ID = s.ID;');