The piriformis stretch is useful for helping relieve sciatica pain and other leg pain if done correctly. Most of the stretches illustrated on the Internet are not specific to the Piriformis, and many of them are not particularly safe.
There is only one correct positioning for stretching the Piriformis: The “FAIR” position (Hip joint Flexed, Adducted and Internally Rotated).
In other words take the affected side cross it over the opposite leg, bending the affected leg at the knee and then drawing the knee to the opposite side of the shoulder. See picture below: