The prepayment penalty terms are typically in a rider to the note. You can obtain a copy of your note by calling your bank. Most lender customer service departments should have the details of the prepayment penalty readily available without having to look at the note, though.
There are two different types of prepayment penalties - "soft" and "hard".
A "soft" prepayment penalty does not apply if you sell your home, but does apply if you refinance. The bank will usually ask for a copy of the final HUD-1 Settlement Statement from the closing agent as proof that the home was sold before waiving the penalty.
A "hard" prepayment applies regardless if you refinance or sell.
You should carefully evaluate your situation before accepting a pre-payment penalty. I have seen some penalties running as high as six (6) months interest. Ouch.
If you are in the process of applying for a new mortgage, you can typically find out if your loan has a prepayment penalty by reviewing the Federal Truth-in-Lending Statement or a copy of the loan commitment letter from the bank. Don't be surprised at the closing table when it may be too late.