Anxiety and panic can manifest itself in so many different ways in my opinion. In my experience, we also tend to link our worry to where we have had a bad experience (or experiences). It is natural to be worried about going to mass because you have had a panic attack there before.
I believe that embracing the panic can really help. You don't have to like it (who does), but I think a big mistake is trying to suppress it when we sometimes need to ride it it out. For me, the anxiety about having a possible panic attack can be much worse than the panic attack itself. I know a panic attack is not going to hurt me and while they are absolutely horrible to go through, I know that I can get through them and that a lot of my worry about it is how other people view me, not if I can get through it. And you know you can get through it, even if it is an unpleasant feeling to say the least.
How soon is the mass for your great grandmother? Do you have time to go see someone to talk this over with? Have there been techniques that you have used successfully in the past in dealing with panic?
If your family knows about your panic attacks, then hopefully they will be understanding of your reluctance to go into that particular church, and I'm sure they know you would really like to attend the mass.
Two possibilities. You could attend the mass but sit as far back as you can, close as possible to an exit. Knowing that if you begin to feel panicky, you can get out quickly without disturbing anyone may allow you to make it through the ceremony. Or you could just stand outside the church and say your own mass or prayers for your great grandmother. I'm not a religious person, I think of myself as spiritual and I believe that your great grandmother will know that you are there and find it sweet and peaceful that you found your own way to be there, your own way to say good-bye.
Take care of yourself. Your great grandmothers higher power is taking care of her now.
I am very sorry for your loss.
Peace
Greenlydia