What is the proper way to extend a pony wall up to the ceiling?
Remove the cap the wall has and farme it with the same size lumber that's on the bottom.
Remove any corner bead wrapping the sheetrock.
Is this is a load bearing wall, you can attach the top plate to the header.
If it's not, you need to determine where the ceiling joists are so you can attach the top plate into it or open the ceiling to install blocking between the 2 ill postioned joists.
Another option would be to toggle bolt the top plate to the sheetrock ceiling. Adhesive could be used to set the top plate.