USE [Database]
GO

IF NOT EXISTS (
     SELECT [name]  
     FROM [master].[sys].[server_principals]
     WHERE [name] = 'user')
BEGIN
    CREATE LOGIN [user]
    WITH PASSWORD = 'user',
    DEFAULT_DATABASE = [Database];
END
GO

IF NOT EXISTS (
	SELECT *
	FROM [dbo].[sysusers]
	WHERE name = N'Casual user')
BEGIN
	CREATE USER [Casual user]
	FOR LOGIN [user]
	WITH DEFAULT_SCHEMA = [Views]
END
GO

GRANT INSERT, SELECT, UPDATE, DELETE
ON SCHEMA :: [Tables]
TO [Casual user];

GRANT EXECUTE, SELECT
ON SCHEMA :: [Functions]
TO [Casual user];

GRANT EXECUTE, SELECT
ON SCHEMA :: [Procedures]
TO [Casual user];

GRANT SELECT, UPDATE
ON SCHEMA :: [Views]
TO [Casual user];