Suppose if some Stark or Bolton had a bastard with some Dorne lady and that boy was raised in Dorne, what will be his last name?
It depends on where the child was born. If the child was born in Dorne, it will be 'Sand.' If they were born in the North, then it will be 'Snow.'
I'm basing this on S07E07, "The Dragon and the Wolf". In that episode, Bran Stark says of Jon Snow to Sam:
He was born in a tower in Dorne.
His last name isn't really Snow, it's Sand.
Dornish bastards are named Sand.
At that point, Bran Stark (as the Three-Eyed Raven) had a vision of Jon Snow's real parents but is yet to have a vision that they were married. This suggests that the bastard child's surname is based on the region the child was born in, rather than where their parents are from, or where they grew up or were raised.
Case in point: Jon Snow. Bran knew this of him at this point:
- father is from the Crownlands
- mother is from the North
- grew up in the North
- born in Dorne
Bran knew all this, so he corrected Jon Snow's surname from 'Snow' to 'Sand.'