Welcome to the Forum. Not being able to sleep changes one's whole life, and if it is caused by a combination of pain and anxiety things are difficult. Medication can help of course - it helps me, but feeling half awake the next day is a big price to pay, so I only have a very weak one which combined wiht relaxation exercises often works.
Can I suggest a couple of things, if we leave the shoulder out of it and if anxiety is the root cause and the brain will not switch off as a result then perhaps there is more you can do to reduce the condition. Beyond Blue has some information on this here:
and for sleep
I've a couple of suggestions of my own, the first being reading this thread
Forums / Anxiety / SELF HELP TIPS FOR MANAGING ANXIETY
which is terribly long, however I've found a lot of use in it.
I also use a free smartphone app called Smiling Mind, which helps to break up those circular useless thoughts. It does take a little practice but works.
If all else fails I read, however that does not suit everyone
I hope you can find something in all the above that does help