How to convert timespan data column into am/pm in sql server

This is how we convert time span data column in am/pm format
Lets take an example:

select CONVERT(varchar(15),CAST('17:30:00.0000000' AS TIME),100)

Run this above syntax in SQL server you will get 5:30PM as output

cast data into time and to convert it into am/pm format use 100 as above