Separation at the seam between a wall and the ceiling of your home is aggravating. There are many possible causes. A house will settle over time which can cause some slight misalignment. It could also be caused by foundation problems or simply too much moisture in a room. Most often the cause is something called truss uplift. Truss uplift happens when the trusses dry out. They tend to arch upward drawing your ceiling up with them. Patching and painting the separation will make it look nice for a season or two but, unless you fix the cause, that crack will be back.
Go into the attic in the winter when the separation is widest and remove the nails holding the ceiling drywall to the trusses with the cats paw or cut them with the hacksaw. Attach the L brackets to the trusses on the side of the truss at the same point you removed the nails. Drive the nail or screw into the truss through the L bracket in the center of the slot that points up, taking care not to drive it through too close to the bottom or top to allow for some play. Drill a small hole using the drill and a very small drill bit through the L bracket and ceiling where you will put the screw to attach the ceiling to the L bracket. Go back into the room and screw the ceiling to the L brackets through the small drill holes.
Repair the separation crack. Remove any old drywall seam tape using a scraper and utility knife. Scrape off any remaining drywall joint compound within a few inches of the crack down the full length of the area needing repair. Make sure the area to be repaired is completely clear of old compound and any dust or debris. Apply a light coat of drywall joint compound over the length of the crack beginning on the ceiling. Apply fiberglass mesh drywall tape over the wet compound centered over the crack. Add another light coat of compound over the tape. At this point, the tape will still be visible. Let it dry overnight. Sand smooth and apply another coat of compound. Let this second coat dry completely. Sand smooth again. Repeat this step, if necessary, before you paint. Make sure the compound is as smooth as possible. If you paint over imperfections, they will be there permanently.
Nail or screw 2 x 6 boards to the trusses horizontally, running along the top edge of the wall drywall where the separation was, to act as a bumper or stop to prevent the wall from being lifted. This needs to be done in the summer when the gap between wall and ceiling is closed. The board must overhang the width of the wall by at least 1 inch. The following winter you may get nail pops. Countersink the nail or screw into the truss using either a drill or hammer. Patch and paint over the indention.