program an arduino mega 2560 with an arduino uno

i fried my mega by applying 12v to it and it burnt out the serial chip. i was wondering if i can use my arduino uno to write code to my arduino mega 2560.

Depends on the approach/application. You could use the Arduino as ISP sketch on the Uno, hook the pins like the sketch, Tools->Programmer->Arduino as ISP. Load your sketch and File->Upload via Programmer.

The second way is to pull the Atmega328 and use the Rx/Tx pins to talk to the Mega Tx/Rx pins to do a standard Mega upload.

Yes you can. See Nick Gammon's writeups on doing so.

If the serial chip is fried, it might interfere with the serial lines. Programming via ICSP bypasses them.

i did the tx/rx to rx/tx and programmed uploaded via programmer. but it keeps saying its no in sync. does this mean my mega board might be fried?

I would setup as Arduino as ISP first and upload the blink sketch. If that works, Burn Bootloader of the Arduino Mega2560 then check the serial upload via the Arduino. If that all checks out, we could see if the Atmega16u2 is still talking.