Can I use the Inspector program selector value to auto populate track name eg. with script

Hi, I have a lot of old cubase projects that just say track 1 track 2 etc but there is a program selector value to control my old Yamaha keyboard (my first midi key - PSR 310 !) . Is there a way to auto rename the tracks using the program selector value to save me having to manually change each one? In the keyboard user guide it has 1-99 with 1-Grand Piano etc. ( not general midi codes)
Many thanks, Simon