My computer name keeps changing when I plug it into a Thunderbolt display
Try making your hostname permanent by typing this command into the Terminal:

sudo scutil --set HostName yourcomputer


My hostname kept changing when I connected to the network because the router was broadcasting a different hostname, and this fixed it.