code: def user_exists(username, domain='', database=None, **kwargs):
      '''
      Find if an user exists in a specific database on the MS SQL server.
      domain, if provided, will be prepended to username
  
      CLI Example:
  
      .. code-block:: bash
  
          salt minion mssql.user_exists 'USERNAME' [database='DBNAME']
      '''
      if domain:
          username = '{0}\\{1}'.format(domain, username)
      if database:
          kwargs['database'] = database
      # We should get one, and only one row
      return len(tsql_query(query="SELECT name FROM sysusers WHERE name='{0}'".format(username), **kwargs)) == f user_exists(username, domain='', database=None, **kwargs):
      '''
      Find if an user exists in a specific database on the MS SQL server.
      domain, if provided, will be prepended to username
  
      CLI Example:
  
      .. code-block:: bash
  
          salt minion mssql.user_exists 'USERNAME' [database='DBNAME']
      '''
      if domain:
          username = '{0}\\{1}'.format(domain, username)
      if database:
          kwargs['database'] = database
      # We should get one, and only one row
      return len(tsql_query(query="SELECT name FROM sysusers WHERE name='{0}'".format(username), **kwargs)) == 1
docs: Find if an user exists in a specific database on the MS SQL server.
      domain, if provided, will be prepended to username
  
      CLI Example:
  
      .. code-block:: bash
  
          salt minion mssql.user_exists 'USERNAME' [database='DBNAME']