@auntmarmar Is your anxiety due to your TKR? I think you need to figure out what is causing the anxiety and depression before you can tackle it. I know nothing about sleeping pills, I do use melatonin and sometimes Benedryl but have not used any prescription remedies in many years. I tried once a long time ago but didn't like how I felt the next day.
It's good that you are seeing a counselor, hopefully that will help you to sort things out. It does not sound as if pain is what is keeping you awake, if I have interpreted your discussion correctly. I will be interested in hearing what approach is taken to help you because I often have trouble sleeping if I am anxious about anything. These days I do not feel anxious but if I get six hours of sleep I consider it to be a good night.