Remove workflow column from SharePoint List

I am going to describe how to delete unwanted or orphaned workflow column from a List.it can be done simply by writing few lines of powershell command as below.
 
  1. function Delete-WorkflowColumn ($webURL, $listName, $columnName)  
  2.  {  
  3.  #Setup variables from the user input  
  4.  $web = Get-SPWeb $webURL  
  5.  $list = $web.Lists[$listName]  
  6.  $column = $list.Fields[$columnName]   
  7. #Make sure the column is not hidden or read only  
  8.  $column.Hidden = $false   
  9. $column.ReadOnlyField = $false   
  10. $column.Update()   
  11. #Delete column and dispose of the web object   
  12. $list.Fields.Delete($column)   
  13. write-host "Deleted column"   
  14. $web.Dispose()   
  15. }  
  16.    
  17.   
  18. Delete-WorkflowColumn -webURL http://ServerName/ -listName "ERP Request" -columnName   
  19.   
  20. "Approval Workflow"  
 
 
 save above notepad with the name of delete.ps1 and then from powershellscript do as below
  1. PS D:\> .\delete.ps1  
  2.  Deleted column  
  3.  PS D:\>