-- Using OPENROWSET
SELECT m.name, m.database_id
FROM OPENROWSET('SQLNCLI', 'Server=RemooteServerName;Trusted_Connection=yes;','SELECT * FROM master.sys.databases') AS m
-- Using OPENDATASOURCE
SELECT name, database_id
FROM OPENDATASOURCE('SQLNCLI','Data Source=RemooteServerName;Integrated Security=SSPI').master.sys.databases