CREATE TRIGGER tddl_limitconnections
ON ALL SERVER
FOR LOGON
AS
BEGIN
IF (SELECT COUNT(*) FROM sys.dm_exec_sessions
    WHERE is_user_process = 1 AND
        login_name = suser_sname()) > 5
    
    PRINT 'You are only allowed a maximum of 5 concurrent connections'
    ROLLBACK
END
GO