As long as your surgeon and your anesthesiologist do not have a problem with it, taking a sleeping pill the night before surgery should not be a problem. It is a good idea to get a good nights sleep before surgery. However, I wouldn't take something you have never tried before the night before surgery and you should take it early enough in the evening that you will be awake and alert when you talk with your surgeon before you go in to surgery.
That's a common question and should be no problem, just check with your surgeon first. And make sure you take the pill early enough in the evening that you are alert in the morning. I had one patient sleep through her surgical time and miss the procedure.