It's a double edged sword.
If you tell the Army docs you simply can't sleep, and need some meds for insomnia, they can easily start digging and inquiring why you need them - looking for an excuse to diagnose you with something beyond insomnia. It's a legitimate fear.
On the other hand, if you go to a private doctor off post, they can prescribe you a sleep med. They problem is the possibility of popping on a piss test for it, especially for benzodiazepines (valium, xanax). Now your command knows 1) You have a sleeping "problem", and 2) You tried to go around the system to get help.
I'm a flyer in the Air Force, so we're under extra scrutiny by the flight surgeon. I was ground trailed on three "No Go" sleeping pills, Ambien, Restoril, and Sonota. You take one pill of each for three nights and then report back to the flight surgeon how they worked. After that you can be prescribed the "No Go" pills for "Aircrew Fatigue Management". The policy originally only applied to aircrews deployed in-theater, then it was extended to stateside use. I was in flight school getting my schedule all jacked around and couldn't sleep. So, having been ground trialed on the meds, I went to flight medicine on base to tell them I needed some "No Go" pills. I was immediately questioned as to why I needed them/there must be something else going on, why else would you need these pills? I slowly walked away before they had a chance to ground me. I had to find other non-pharmaceutical ways to get adequate sleep until I finished school.