TSQL LDAP query via Linked Server
to query the active directory I use the procedure xp_logininfo


  Requires membership in the sysadmin fixed server role or membership in
  the public fixed database role in the master database with EXECUTE
  permission granted.


I have been using the following script and it works fine for me:

SELECT @@SERVERNAME
--myserver

DECLARE @NTLogin nvarchar(128); 
SET @NTLogin = 'mycompany\person_or_group_I_want_to_check'

DECLARE @UserList TABLE (
         [Account Name] nvarchar(128),
         [Type] nvarchar(128),
         [Privilege] nvarchar(128),
         [Mapped Login Name] nvarchar(128),
         [Permission Path] nvarchar(128) )


INSERT INTO @UserList EXEC xp_logininfo @NTLogin, 'all' --insert group information

IF EXISTS (SELECT * FROM @UserList WHERE [Type] = 'group') --only if it's a group
   INSERT INTO @UserList EXEC xp_logininfo @NTLogin, 'members' --insert member information

SELECT * FROM @UserList