During the physical exam, your doctor may try to pinpoint the cause of your pain by pressing directly on various places on your hips and buttocks. He or she may also move your legs into a variety of positions that will gently stress your sacroiliac joints.
Imaging tests
An X-ray of your pelvis can reveal signs of damage to the sacroiliac joint. If ankylosing spondylitis is suspected, your doctor might recommend magnetic resonance imaging (MRI) — a test that uses radio waves and a strong magnetic field to produce very detailed cross-sectional images of both bone and soft tissues.
Anesthetic injections
Because low back pain can be caused by so many different types of problems, your doctor may suggest using injections of anesthetics to help pinpoint the diagnosis. For example, if an injection of numbing medicine into your sacroiliac joint stops your pain, it's likely that the problem is in your sacroiliac joint. However, the numbing medicine can leak into nearby structures, and that can reduce the reliability of this test.
Source: http://www.mayoclinic.com