Do you want the versions of all the software you have installed on the system?
# pkg_info
or
# ls -1 /var/db/pkg/
Or, do you want the versions of all the software that is available in the ports tree, that can be installed?
$ awk -F"|" '{ print $1 }' /usr/ports/INDEX-8 | sort | uniq