You have to consider 2 scenarios. Was the lease constituted over the property before the foreclosure or after?
If the lease was constituted before the foreclosure, the banks would usually honor it and just allow the lease to expire. If the lease was constituted after the foreclosure proceedings and the parties to the lease know about such proceedings, I believe the bank can terminate the lease.