Return row with most matching parameters
;WITH c AS
(
  SELECT RowID, 
    c = CASE WHEN DocumentID = @DocumentID THEN 1 ELSE 0 END
      + CASE WHEN EmployeeID = @EmployeeID THEN 1 ELSE 0 END
      + CASE WHEN CompanyID  = @CompanyID  THEN 1 ELSE 0 END
  FROM dbo.TableName
)
SELECT TOP (1) RowID FROM c ORDER BY c DESC;