I have a sharp neck pain neat right ear?

TMJ? Most often sharp pain near an ear is due to a local process.If on the surface of the head, it could be something like a skin infection/pimple.If deeper & behind the ear, it's often the 1st neck vertebrae out of whack.In front of the ear, it's often TMJ or cranial bone malfunction.An osteopathic dr may perform diagnostic tests, incl hands-on diagnosis, & may be able treat the cause right in office.
Cervical joints. Sharp pain in the upper neck can be from muscle spasms, and soft-tissue reaction to underlying neck issues. Many time the lesser occipital nerve, that comes out of your upper neck and travels over to, and around your ear, can be irritated. Anti-inflammatories, ice/heat, massage, pt, and injections can all help if it continues. Always seek medical eval. Since other issues need to be ruled out.