do you always do
or does that number vary?
pacmd set-default-sink 10
A script is going to do exactly the same as you are doing already.
I don't know how to the syntax so here are the parts of the script you'll need.
execute then match the output of that to a string (name of the headphone or something)
Store that number.
pacmd set-default-sink <stored number>
When you got that in a file make it executable and place the path to that file in a progran named "Startup Applications" (aka gnome-session-properties if you execute it from command line).
It's uglier, but you can also place a bash script instead of a path of an executable file in there.