Obviously you will need to know the serial protocol being used to communicate. Just send a known command to each port and check back for the expected response. Ports with no device on them will timeout/throw an IOException.
Or you if you don't want to do this through code you can try the same using HyperTerminal or another serial terminal program.
Try something like following:
(Please note I am writing this from memory and don't guarantee this will compile/that I have the method names 100% right, but it gives the general idea).
foreach(string portname in SerialPort.GetPortNames())
{
// Use your connection settings - own baud rate etc
SerialPort sp = new SerialPort(portname,4800, Parity.Odd, 8, StopBits.One);
try
{
sp.Open();
sp.Write("Your known command to phone");
Thread.Sleep(500);
string received = sp.ReadLine();
if(received == "expected response")
{
Console.WriteLine("Phone connected to: " + portname);
break;
}
}
catch(Exception)
{
Console.WriteLine("Phone NOT connected to: " + portname);
}
finally
{
sp.Close();
}
}