Scotland breaks even within the UK.
I think that says more about your prejudices than anything about Scotland's motivation for seeking Independence. Given how much "Sovereignty" featured in the EU referendum, it would be extremely hypocritical to deny it to others. I mean the EU sided with the UK interests far more than the UK sides with Scottish interests (iirc hansard had it at single digits).
There's a school of thought that goes along the lines of; Scotland becomes the successor state to the Uk in the EU. Also the Spain thing has been debunked numerous times already. Spain's only problem would be in the event of UDI as that's the route Catalonia has to take since there is no constitutional mechanism for regions of Spain to leave. As long as it's not UDI, Spain wouldn't veto.The EU can't guarantee them spots. Under EU law, there's a big old process new countries must go through to join the EU. Scotland would be counted as one, because it is only a member because the UK is a member as well. If the UK leaves, Scotland goes. If Scotland leaves the UK, it's a new, sovereign state and must apply on its own. Spain might also veto them joining, because it wants to set a precedent for Catalonia ("if you leave Spain, no EU membership for you, mwahaha!").