Rampur (UP): Samajwadi Party (SP) national general secretary and former cabinet minister Mohammad Azam Khan was sentenced to two years imprisonment along with a penalty of Rs 2,500 in a hate speech case by an MP-MLA court here on Saturday, prosecution counsel said.