I Install SQL server in my system and I have to check on which port number SQL is working in my system
This query works for me:
SELECT DISTINCT local_tcp_port FROM sys.dm_exec_connections WHERE local_tcp_port IS NOT NULL