The role of a defense attorney is to have clients found not guilty. Ethically should this role change if the attorney knows the client is guilty?
No, this role should not change in this circumstance.
The reason for this is that the whole point of having trials and lawyers and such is to make sure that the government cannot punish someone for their crimes without first proving that that person is guilty. We have the 5th Amendment to ensure that defendants cannot be forced to convict themselves -- it is the role of the prosecutor to convict the defendant.
Even if the lawyer knows their client is guilty, they must force the government to prove that guilt. They must make sure that the government plays by the rules to prove that guilt. Therefore, they must present a vigorous defense to make sure the prosecution has real evidence that was gathered legally, that its witnesses are not perjuring themselves, etc.
So, in order to keep the government honest, it is important that defense attorneys defend their clients vigorously even if they are factually guilty of the crime.
While representing a client, or in any other situation, it is illegal and unethical for attorneys to speak falsehood in a court of law. An attorney cannot be expected to prove in a court of law that his or her client is "not guilty" without knowingly making false statements to this effect in the court. Thus, it is definitely unethical and illegal for an attorney, who knows his or her client to be guilty, to try to prove in a court of law that the client is really not guilty.
Then what about the role of client as someone whose professional duty is to always try to establish innocence of the client? Put in plain words, this is a common misconception. Attorneys have no duty to prove their client "not guilty" in court of law, even when they knows for sure that the client is guilty. The duty of attorneys is not to help guilty avoid the legal consequences of their illegal act. Their duty is only to help their client in getting the best possible deal within the framework of the legal system.
It is worthwhile noting that it is a common practice for attorneys advice their clients to accept their crime and plead guilty, when they believe that this will help in securing lighter punishment for the clients.