What is the best ointment to use when you burn your hand with a frying pan?

Cool water. Use cool/luke-warm water first to stop the burning. Leave blisters intact. Silvadene (silver sulfadiazine) cream is specifically for burns—helps cool & prevent infections—but may be by prescription only. If burn involves much of hand or other large areas, seek emergency help at once to prevent complications.
Not ointment. The thing to do for any burn, immediately, is to grab a pack of frozen vegetables or an ice pack or ice in a baggie and apply it for 15 minutes to the burned area. This will reduce the pain, limit the spread of the burn, and be of great relief. If you did not do these, or applied oil or butter (useless!), then you will have a painful area to deal with. Protect it, keep it clean and wait.
Depends. If the skin is still intact, then you can use any first aid cream like neosporin, Bacitracin or even vaseline. If not, silver sulfadiazine is an excellent ointment available by prescription. Be careful when you cook, please! All the best to you, dr. Fred.